package com.tenebrous.jestic.mapper.idao.framwork.meber.organ;

import com.tenebrous.jestic.entity.framwork.meber.organ.OrgOrganize;
import com.tenebrous.jestic.mapper.ISuperMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

//@Mapper
public interface OrgOrganizeMapper extends ISuperMapper<OrgOrganize> {

    OrgOrganize selectById(@Param("id") String id);

    @Select("SELECT * FROM ORG_ORGANIZE A WHERE A.OGRADE = #{ograde} ORDER BY A.CREATE_DATE")
    List<OrgOrganize> queryOrgByOgrade(@Param("ograde") String ograde);

    List<OrgOrganize> selectByCondition(@Param("companyids") String[] companyids, @Param("pid") String pid, @Param("name") String name, @Param("otypes") String[] otypes);

    List<OrgOrganize> queryChartList(@Param("companyids") String[] companyids);

    @Select("SELECT id,code,name,fullname FROM ORG_ORGANIZE A WHERE A.OGRADE = #{ograde} ORDER BY A.CREATE_DATE")
    List<Map<String, Object>> queryMapListByOgrade(@Param("ograde") String ograde);

    @Delete("DELETE FROM ORG_ORGANIZE WHERE COMPANYID=#{companyid}")
    void deleteByCompanyid(@Param("companyid") String companyid);

    @Delete("DELETE FROM ORG_ORGANIZE WHERE OGRADE=#{code}")
    void deleteByOgrade(@Param("code") String code);
}